package dome2;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 7-42 矩阵相加
 * User: 王圆豪
 * Date: 2024-06-12
 * Time: 15:49
 */
public class Main{
    public static Scanner scan = new Scanner(System.in);
    public static void main1(String[] args) {
        int m = scan.nextInt();//矩阵的行
        int n = scan.nextInt();//矩阵的列
        int[][] a = new int[m][n];
        inputData(a);
        int[][] b = new int[m][n];
        inputData(b);
        int[][] c = addMatrix(a, b);
        showResult(c);
    }
    public static void inputData(int[][] arr){
        for(int i =0;i<arr.length;i++)
            for(int j=0;j<arr[i].length;j++)
                arr[i][j] =scan.nextInt();
    }
    public static int[][] addMatrix(int[][]arr1,int[][]arr2){
        int [][] c = new int[arr1.length][arr1[0].length];
        for(int i =0;i<arr1.length;i++)
            for(int j =0;j<arr1[i].length;j++)
                c[i][j] = arr1[i][j] + arr2[i][j];
        return c;
    }

    public static void showResult(int[][] arr){
        for(int i =0;i<arr.length;i++){
            for(int j =0;j<arr[i].length;j++)
                System.out.print(" "+arr[i][j]);
            System.out.println();
        }
    }
}
